package 线程的创建;
//火车票售卖系统
public class text4 {
    public static void main(String[] args) {
        TickWindow tickWindow = new TickWindow();
        new Thread(tickWindow,"窗口1").start();
        new Thread(tickWindow,"窗口2").start();
        new Thread(tickWindow,"窗口3").start();
        new Thread(tickWindow,"窗口4").start();
    }
}
class TickWindow implements Runnable {
    private int tick = 100;
    public void run() {
        while (true) {
            if (tick > 0) {
                Thread th=Thread.currentThread();//获取当前线程对象
                String name = th.getName();//获取线程名称
                System.out.println(name + "正在售卖第" + tick + "张票");
                tick--;

            }
        }
    }


}